package com.system.api.rbac.entity.po;

import com.system.api.setting.enums.MenuTypeEnum;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.yang.common.core.annotation.Chinese;
import org.yang.database.orm.entity.BaseModel;

import static com.system.common.constant.MessageConstant.*;

/**
 * 菜单
 * @author: lslands
 * @version: 1.0
 * @create: 2024/5/19
 * @description:
 */

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class SysMenu extends BaseModel {

    /**
     * 父级ID
     * @mock 0
     * @required
     */
    @NotNull(message = PARENT_EMPTY)
    private Long parentId;

    /**
     * 企业ID
     * @mock 1
     * @required
     */
    private Long companyId;

    /**
     * 名称
     * @mock 首页
     * @required
     */
    @NotBlank(message = MENU_NAME_EMPTY)
    private String title;

    /**
     * 国际化KEY
     * @mock system.menu.name
     * @required
     */
    @Chinese
    private String locale;

    /**
     * 图标
     * @mock #home
     * @required
     */
    private String icon;

    /**
     * 类型
     * @mock M
     * @required
     * @apiNote C/目录;M/菜单;L/超级连接
     */
    private String type;

    /**
     * 路由地址
     * @mock /**
     * @required
     */
    private String path;

    /**
     * 重定向
     * @mock /
     */
    private String redirect;

    /**
     * 组件地址
     * @mock rbac/**
     * @required
     */
    private String component;

    /**
     * 菜单状态(true显示/false隐藏)
     * @mock true
     */
    private Integer visible;

    /**
     * 排序
     * @mock 99
     */
    private Integer sort;

    public SysMenu(Long id, Integer enabled, Integer revision) {
        super(id, enabled, revision);
    }
}